/**
 * Project: complex.java
 * 
 * File Created at 2011-9-9
 * $Id$
 * 
 * Copyright 2008 Alibaba.com Croporation Limited.
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * Alibaba Company. ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with Alibaba.com.
 */
package complex.java.serialize;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;

/**
 * TODO Comment of JavaExternalizable
 * 
 * @author ymkyve
 */
public class JavaExternalizable {
    public static void main(String[] args) {
        try {
            Route route = new Route();
            route.setRouteId("1111");
            ByteArrayOutputStream output = new ByteArrayOutputStream();
            ObjectOutputStream objectOutput = new ObjectOutputStream(output);
            objectOutput.writeObject(route);
        
            ByteArrayInputStream input = new ByteArrayInputStream(output.toByteArray());
            ObjectInputStream objectInput = new ObjectInputStream(input);
            Object obj = objectInput.readObject();
            System.out.println(obj);
            
            
            
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
}
